
<script>
function QueryGET(TheName){
    var urlt = window.location.href.split("?");
	
	//如果是rewrite的
	if(typeof(urlt[1]) == 'undefined'){
		var urlt = window.location.href.split("/");
		var temp = new Array();
		var channel = urlt.pop();
		var temp2 = channel.split(".");
		if(typeof(temp2[1]) == 'undefined'){
			temp['page'] = 'index';
			temp['channel']    = channel;
		}else{
			temp['page'] = temp2.shift();
			temp['channel']    = urlt.pop();
		}
		
        var TheValue = temp[TheName];
	}else{
        var gets = urlt[1].split("&");
        
        for (var i = 0; i < gets.length; i++) {
            var get = gets[i].split("=");
            if (get[0] == TheName) {
                var TheValue = get[1];
                break;
            }
        }
	}
    return TheValue;
} 
  var channel = QueryGET('channel');
  var page    = QueryGET('page');
  $(function(){
  	$.post(APP+'&mod=Diy&act=checkUserRole',{page:page,channel:channel},function(result){
 		if(result == 1){
			$('body').append('<a id="openDiy" href="__APP__&mod=Diy&diy&page={$page}&channel={$channel}" style="display:none"><img src="../Public/images/btn_diy.gif" /></a>');
			$.getScript('../Public/js/diy_normal.js');
		}
	 })
  })	
 
</script>
<php>
    if($admin && $openDiy){
</php>
<div id="diy_layout_list" style="display:none;">
    <div class="diy_1">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>
            布局框架
        </div>
        <div class="diy_1_C line_E">
        </div>
    </div>
    <div class="diy_1_1 bg_eee">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>布局框架
        </div>
        <div class="diy_1_1_L line_E">
        </div>
        <div class="diy_1_1_R line_E">
        </div>
        <div class="C">
        </div>
    </div>
    <div class="diy_1_2 bg_eee">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>布局框架
        </div>
        <div class="diy_1_2_L line_E">
        </div>
        <div class="diy_1_2_R line_E">
        </div>
        <div class="C">
        </div>
    </div>
    <div class="diy_2_1 bg_eee">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>
            布局框架
        </div>
        <div class="diy_2_1_L line_E">
        </div>
        <div class="diy_2_1_R line_E">
        </div>
        <div class="C">
        </div>
    </div>
    <div class="diy_1_3 bg_eee">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>
            布局框架
        </div>
        <div class="diy_1_3_L line_E">
        </div>
        <div class="diy_1_3_R line_E">
        </div>
        <div class="C">
        </div>
    </div>
    <div class="diy_3_1 bg_eee">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>
            布局框架
        </div>
        <div class="diy_3_1_L line_E">
        </div>
        <div class="diy_3_1_R line_E">
        </div>
        <div class="C">
        </div>
    </div>
    <div class="diy_1_2_1 bg_eee">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>
            布局框架
        </div>
        <div class="diy_1_2_1_L line_E">
        </div>
        <div class="diy_1_2_1_C line_E">
        </div>
        <div class="diy_1_2_1_R line_E">
        </div>
        <div class="C">
        </div>
    </div>
    <div class="diy_1_1_1 bg_eee">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>
            布局框架
        </div>
        <div class="diy_1_1_1_L line_E">
        </div>
        <div class="diy_1_1_1_C line_E">
        </div>
        <div class="diy_1_1_1_R line_E">
        </div>
        <div class="C">
        </div>
    </div>
    <div class="diy_15_15_1 bg_eee">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>
            布局框架
        </div>
        <div class="diy_15_15_1_L line_E">
        </div>
        <div class="diy_15_15_1_C line_E">
        </div>
        <div class="diy_15_15_1_R line_E">
        </div>
        <div class="C">
        </div>
    </div>
    <div class="diy_1_15_15 bg_eee">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>
            布局框架
        </div>
        <div class="diy_1_15_15_L line_E">
        </div>
        <div class="diy_1_15_15_C line_E">
        </div>
        <div class="diy_1_15_15_R line_E">
        </div>
        <div class="C">
        </div>
    </div>
   <div class="diy_1_12_12_1 bg_eee">
        <div class="bg_diy_tit">
            <a href="#" class="ico_diydel R mt5 mr5" title="删除" onclick='deleteDiy($(this).attr("rel"))'>删除</a>
            布局框架
        </div>
        <div class="diy_1_12_12_1_L line_E">
        </div>
        <div class="diy_1_12_12_1_C line_E">
        </div>
         <div class="diy_1_12_12_1_P line_E">
        </div>
        <div class="diy_1_12_12_1_R line_E">
        </div>
        <div class="C">
        </div>
    </div>
    <div id="placeholder" class="bg_p">
    </div>
</div>
<div id="tempDiyData" style="display:none;">
    {$tempData}
</div>
<div id="diy_adaptable" style="left:0px;top:0px;display:none">
    <div id="diy_tab">
        <p>
            <a href="javascript:void(0)" onclick="saveLayout()"><img src="../Public/images/btn_bc.gif" /></a><a href="javascript:void(0)" onclick="previewLayout()"><img src="../Public/images/btn_yl.gif" /></a><a href="#"><img src="../Public/images/btn_cx.gif" /></a><a href="__URL__&page={$page}&channel={$channel}"><img src="../Public/images/btn_x.gif" /></a>
        </p>
        <ul>
            <li>
                自定义:
            </li>
            <li>
            	<a href="#" class="on diy_tab_list">页面排版</a>
            </li>
            <li>
            	<a href="__APP__&mod=Page&act=index&channelId={$channel}&id={$page}" class="diy_tab_list">频道管理</a>
            </li>
			<li>
            	<a href="__APP__&mod=Data" target="_blank" class="diy_tab_list">数据查询工具</a>

            </li>
        </ul>
    </div>
    <div id="controlcontent">
        <div id="diy_nav">
            <a href="javascript:void(0);" rel="div_addFrame" class="on"><img src="../Public/images/layout.gif" />
                <br/>
                添加框架
            </a>
            <a href="javascript:void(0);" rel="div_addModel"><img src="../Public/images/module.gif" />
                <br/>
                添加模板
            </a>
        </div>
        <div id="diy_nav2">
            <div id="div_addFrame">
                <a href="javascript:void(0)" class="addFrame" rel="1"><img src="../Public/images/layout-1.gif" />
                    <br/>
                    100%框架
                </a>
                <a href="javascript:void(0)" class="addFrame" rel="1_1"><img src="../Public/images/layout-1-1.gif" />
                    <br/>
                    1：1
                </a>
                <a href="javascript:void(0)" class="addFrame" rel="1_2"><img src="../Public/images/layout-1-2.gif" />
                    <br/>
                    1：2
                </a>
                <a href="javascript:void(0)" class="addFrame" rel="2_1"><img src="../Public/images/layout-2-1.gif" />
                    <br/>
                    2：1
                </a>
                <a href="javascript:void(0)" class="addFrame" rel="3_1"><img src="../Public/images/layout-3-1.gif" />
                    <br/>
                    3：1
                </a>
                <a href="javascript:void(0)" class="addFrame" rel="1_3"><img src="../Public/images/layout-1-3.gif" />
                    <br/>
                    1：3
                </a>
                <a href="javascript:void(0)" class="addFrame" rel="1_2_1"><img src="../Public/images/layout-1-2-1.gif" />
                    <br/>
                    1：2：1
                </a>
                <a href="javascript:void(0)" class="addFrame" rel="1_1_1"><img src="../Public/images/layout-1-1-1.gif" />
                    <br/>
                    1：1：1
                </a>
                 <a href="javascript:void(0)" class="addFrame" rel="15_15_1"><img src="../Public/images/layout-15-15-1.gif" />
                    <br/>
                    3：3：2
                </a>
                 <a href="javascript:void(0)" class="addFrame" rel="1_15_15"><img src="../Public/images/layout-1-15-15.gif" />
                    <br/>
                    2：3：3
                </a>
                <a href="javascript:void(0)" class="addFrame" rel="1_12_12_1"><img src="../Public/images/layout-1-12-12-1.gif" />
                    <br/>
                    5：6：6：5
                </a>
            </div>
            <div id="div_addModel" style="display:none">
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:blog">博客模块</a>
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:wiki">百科模块</a>
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:group">团队模块</a>
                
                
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:GroupBlog">团队博客</a>
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:GroupWiki">团队协作</a>
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:GroupUser">团队用户</a>
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:GroupFeed">团队动态</a>
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:GroupForum">团队讨论</a>
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:GroupAffiche">团队公告</a>
                
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:user">用户模块 </a>
                <a href="javascript:void(0)" class="addModel" rel="false" namespace="w:ask">知道模块</a>
				<a href="javascript:void(0)" class="addModel" rel="false" namespace="w:image">图片模块</a>
				<a href="javascript:void(0)" class="addModel" rel="false" namespace="w:video">视频模块</a>
				<a href="javascript:void(0)" class="addModel" rel="false" namespace="w:feed">动态模块</a>
				<a href="javascript:void(0)" class="addModel" rel="false" namespace="w:cmsdoc">文章模块</a>
				<a href="javascript:void(0)" class="addModel" rel="false" namespace="w:bbs">论坛模块</a>
				<a href="javascript:void(0)" class="addModel" rel="false" namespace="w:vote">投票模块</a>
				<a href="javascript:void(0)" class="addModel" rel="false" namespace="w:custom">自定义模块</a>

				<a href="javascript:void(0)" class="addModel" rel="1" namespace="w:tab">tab框架</a>
            </div>
        </div>
        <div class="C">
        </div>
    </div>
</div>
<script>
                    	var saveLayoutData = new Array();
                    	<volist name="layoutData"  id="vo">
                    		saveLayoutData['{$key}'] = new Array();
                    		<php>$voKey = $key;</php>
                    		<volist name="vo" id="so">
                    			if('object' != typeof(saveLayoutData['{$voKey}']['{$key}'])){
                    				saveLayoutData['{$voKey}']['{$key}'] = new Array();
                    			}
                				<php>$soKey = $key;</php>
                    			<volist name="so" id="no">
                					saveLayoutData['{$voKey}']['{$soKey}'][{$key}] = '{$no}';
            						var id = '{$voKey}-{$soKey}-'+parseInt({$key}+1);
            					</volist>
                    		</volist>
                    	</volist>
						var targetPage = '{$page}';
						var targetChannel = '{$channel}';
                    	
</script>
<script type="text/javascript" src="../Public/js/diy.js">
</script>
	<link href="__PUBLIC__/js/kissy/themes/default/editor-min.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="__PUBLIC__/js/kissy/neweditor.js"></script>
	
	<script type="text/javascript" src="__PUBLIC__/js/ui.draggable.js">
	</script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-ui-1.7.2/selectable.js">
	</script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-ui-1.7.2/sortale.js">
	</script>
	    <script type="text/javascript" src="__PUBLIC__/js/tsjs.json2select.js" ></script>
	
<php>
    }
</php>

<script type="text/javascript" src="__PUBLIC__/js/jquery-ui-1.7.2/tabs.js">
</script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-ui-1.7.2/accordion.js">
</script>
